﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using ZhaoxiLearningWpf.Common;
using ZhaoxiLearningWpf.ViewModel;

namespace ZhaoxiLearningWpf.View
{
    /// <summary>
    /// MainView.xaml 的交互逻辑
    /// </summary>
    public partial class MainView : Window
    {
        public MainView()
        {
            InitializeComponent();

            MainViewModel mainViweModel = new MainViewModel();
            this.DataContext = mainViweModel;
            mainViweModel.UserInfo.UserName = GlobalValues.UserInfo.UserName;
            mainViweModel.UserInfo.Avator = GlobalValues.UserInfo.Avatar;
            mainViweModel.UserInfo.Gender = GlobalValues.UserInfo.Gender;

            this.MaxHeight = SystemParameters.MaximizedPrimaryScreenHeight;
        }

        private void Border_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            if (e.LeftButton == MouseButtonState.Pressed) {
                DragMove();
            }
        }

        private void MinWin_click(object sender, RoutedEventArgs e)
        {
            this.WindowState = WindowState.Minimized;
        }

        private void MaxWin_click(object sender, RoutedEventArgs e)
        {
            this.WindowState = ( this.WindowState == WindowState.Maximized ) ? WindowState.Normal : WindowState.Maximized;
        }

        private void CloseWin_click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }
    }
}
